{% extends "base.html" %}


{% block title %}{{ section.title }}{% endblock title %}


{% block header_logo %}
<p class="header-title">
  <img class="logo" src="{{ get_url(path="banner.png") }}" alt="{{ section.title }}" title="Logo"/>
</p>
{% endblock header_logo %}


{% block content %}
<h1>Home</h1>

<!-- Table of Contents -->
{% if section.toc %}
<div>
  <h2 id="toc">Table of Contents</h2>
  <ul>
    {# NOTE: static toc for dynamic template rather than md content. #}
    <li>
      <a href="#">Home</a>
      <ul>
        <li>
          <a href="#toc">Table of Contents</a>
        </li>
        <li>
          <a href="#recent">Recent Entries</a>
        </li>
      </ul>
    </li>
    {% for h1 in section.toc %}
    <li>
      <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
      {% if h1.children %}
      <ul>
        {% for h2 in h1.children %}
        <li>
          <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
        </li>
        {% endfor %}
      </ul>
      {% endif %}
    </li>
    {% endfor %}
  </ul>
</div>
{% endif %}

<!-- Recent Entries -->
{% set archive_section = get_section(path="archive/_index.md") %}
{% set all_pages = archive_section.pages %}
{% set sorted_pages = all_pages | sort(attribute="date") | reverse | slice(end=3) %}
{% if sorted_pages %}
<div>
  <h2 id="recent">Recent Entries</h2>
  <ul>
    {% for page in sorted_pages %}
    <li>
      <p>{% if page.date %}{{ page.date }} &bullet;{% endif %}
        <a href="{{ page.permalink }}">{{ page.title }}</a>
      </p>
      {% if page.description %}
      <p>{{ page.description }}</p>
      {% elif page.summary %}
      <p>{{ page.summary }}</p>
      {% else %}
      <p>{{ page.title }}....</p>
      {% endif %}
    </li>
    {% endfor %}
  </ul>
</div>
{% endif %}

{{ section.content | safe }}

{% endblock content %}
